﻿
namespace BLPicker.CodeContracts
{
    using System.Diagnostics.Contracts;

    [ContractClassFor(typeof(IBusinessLayerFactory<>))]
    /// <summary>
    /// Code contract class for IBusinessLayerFactory interface.
    /// </summary>
    /// <typeparam name="TBusinessLayer">Type of business layer.</typeparam>
    public abstract class BusinessLayerFactoryContract<TBusinessLayer> : IBusinessLayerFactory<TBusinessLayer>
    {

        /// <summary>
        /// Empty code contract for IBusinessLayerFactory<>.GetBusinessLayer() method.
        /// </summary>
        TBusinessLayer IBusinessLayerFactory<TBusinessLayer>.GetBusinessLayer()
        {
            return default(TBusinessLayer);
        }

        /// <summary>
        /// Code contracts for IBusinessLayerFactory<>.GetBusinessLayer() method
        /// which checks that parameter "name" is not null or whitespace.
        /// </summary>
        TBusinessLayer IBusinessLayerFactory<TBusinessLayer>.GetBusinessLayer(string name)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(name));

            return default(TBusinessLayer);
        }
    }
}
